emacs.git
2 years agoNew variable haiku-pass-control-tab-to-system
Tor-björn Claesson [Wed, 3 Apr 2024 07:25:59 +0000 (10:25 +0300)]
New variable haiku-pass-control-tab-to-system

Allow passing C-TAB on to the Haiku operating system, fixing
window switching when an Emacs frame has focus (Bug#70138).
* src/haiku_support.cc (DispatchMessage): Conditionally pass
message to BWindow.
* src/haiku_support.h:
* src/haikufns.c (haiku_should_pass_control_tab_to_system): Add
variable haiku-pass-control-tab-to-system, and C function
haiku_should_pass_control_tab_to_system.

Co-authored-by: Po Lu <luangruo@yahoo.com>
Copyright-paperwork-exempt: yes

2 years agoSimplify tab-line-switch-to-prev-tab and tab-line-switch-to-next-tab.
Juri Linkov [Wed, 3 Apr 2024 17:42:11 +0000 (20:42 +0300)]
Simplify tab-line-switch-to-prev-tab and tab-line-switch-to-next-tab.

* lisp/tab-line.el (tab-line-switch-to-prev-tab)
(tab-line-switch-to-next-tab): Use buffers instead of tabs.

2 years agoDon't use file-truepath in Eglot (bug#70036)
Theodor Thornhill [Sat, 30 Mar 2024 19:52:41 +0000 (20:52 +0100)]
Don't use file-truepath in Eglot (bug#70036)

`file-truepath' is slow because of recursive calls and being implemented
in lisp.  It seems to not be needed in eglot, but it is used behind the
scenes in `find-buffer-visiting', thus appearing in profiles.  Moving
the implementation to a hash map will yield similar performance
benefits, but wouldn't require us to rewrite `file-truename' in C.

* lisp/progmodes/eglot.el (eglot-lsp-server): Convert 'managed-buffers'
to a hashmap.
(eglot-uri-to-path): Don't use file-truepath, as it is too slow to be
included in the hot path.
(eglot--on-shutdown): Use buffers from buffer map.
(eglot--managed-mode): Add buffer to map, rather than list. Also remove
it from the map on deactivation.
(eglot-handle-notification): Expose server and get buffer from the
buffer map.

2 years ago; * java/org/gnu/emacs/EmacsView.java (onKeyDown): Delete debugging code.
Po Lu [Wed, 3 Apr 2024 12:43:42 +0000 (20:43 +0800)]
; * java/org/gnu/emacs/EmacsView.java (onKeyDown): Delete debugging code.

2 years agoPrevent detachWindow from deleting frames
Po Lu [Wed, 3 Apr 2024 12:41:08 +0000 (20:41 +0800)]
Prevent detachWindow from deleting frames

* java/org/gnu/emacs/EmacsWindowManager.java (detachWindow):
Remove WINDOW from the window list prior to pruning.

2 years ago; * java/org/gnu/emacs/EmacsWindow.java (reparentTo): Typo.
Po Lu [Wed, 3 Apr 2024 12:33:58 +0000 (20:33 +0800)]
; * java/org/gnu/emacs/EmacsWindow.java (reparentTo): Typo.

2 years agoRevise android.texi to agree with last change
Po Lu [Wed, 3 Apr 2024 12:30:18 +0000 (20:30 +0800)]
Revise android.texi to agree with last change

* doc/emacs/android.texi (Android Windowing): Revise to agree
with last change

2 years agoBetter align Emacs window management with Android task lifecycles
Po Lu [Wed, 3 Apr 2024 12:29:10 +0000 (20:29 +0800)]
Better align Emacs window management with Android task lifecycles

* java/org/gnu/emacs/EmacsActivity.java (onCreate): Permit
overriding by child classes.
(onDestroy): Minor stylistic adjustments.
(getAttachmentToken): New function.

* java/org/gnu/emacs/EmacsMultitaskActivity.java (onCreate)
(getAttachmentToken): New functions.

* java/org/gnu/emacs/EmacsWindow.java (EmacsWindow):
<attachmentToken, preserve, previouslyAttached>: New variables.
(onActivityDetached): Remove redundant isFinishing argument.
(reparentTo): Reset the foregoing fields before registering with
the window manager.

* java/org/gnu/emacs/EmacsWindowManager.java
(EmacsWindowManager): Rename from EmacsWindowAttachmentManager.
(WindowConsumer): New function getAttachmentToken.
(isWindowEligible): New function.
(registerWindowConsumer, registerWindow, removeWindowConsumer)
(detachWindow): Implement a new window management strategy on
API 29 and subsequent releases where both varieties of toplevel
window are permanently, except when reparented, bound to the
activities to which they attach, and Emacs establishes at
strategic junctures whether those activities remain present.
(getTaskToken, pruneWindows): New functions.

2 years agoRevert "Check if lexical-binding is enabled before warning"
Mattias Engdegård [Wed, 3 Apr 2024 09:28:49 +0000 (11:28 +0200)]
Revert "Check if lexical-binding is enabled before warning"

This reverts commit 7de192680fdac6938f5704aea0310b85b0da9c5e.
The logic is wrong (bug#70068).

2 years agoMake lexical-binding cookie warning test more robust
Mattias Engdegård [Wed, 3 Apr 2024 09:27:16 +0000 (11:27 +0200)]
Make lexical-binding cookie warning test more robust

* test/lisp/emacs-lisp/bytecomp-tests.el
(bytecomp-tests--lexical-binding-cookie):
Run with lexical-binding both on and off.

2 years agoCheck if lexical-binding is enabled before warning
Philip Kaludercic [Tue, 2 Apr 2024 16:01:27 +0000 (18:01 +0200)]
Check if lexical-binding is enabled before warning

* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Suppress "file
has no `lexical-binding' directive" is the variable is non-nil,
as is the case with 'lisp-interaction-mode'.  (Bug#70068)

2 years ago; * src/json.c (json_parse_array): Remove unused variable.
Mattias Engdegård [Wed, 3 Apr 2024 07:52:55 +0000 (09:52 +0200)]
; * src/json.c (json_parse_array): Remove unused variable.

2 years ago; Autoload 'global-completion-preview-mode'
Eshel Yaron [Wed, 3 Apr 2024 06:35:18 +0000 (08:35 +0200)]
; Autoload 'global-completion-preview-mode'

* lisp/completion-preview.el (global-completion-preview-mode):
Add autoload cookie.

2 years ago; * src/json.c (Fjson_insert): Fix typo in doc (bug#70156).
Randy Taylor [Wed, 3 Apr 2024 01:29:55 +0000 (21:29 -0400)]
; * src/json.c (Fjson_insert): Fix typo in doc (bug#70156).

2 years ago; * src/json.c (Fjson_insert): Doc fix.
Eli Zaretskii [Tue, 2 Apr 2024 17:43:29 +0000 (20:43 +0300)]
; * src/json.c (Fjson_insert): Doc fix.

2 years agoNew functions to set and use context of window points (bug#33871)
Juri Linkov [Tue, 2 Apr 2024 17:17:41 +0000 (20:17 +0300)]
New functions to set and use context of window points (bug#33871)

* lisp/dired.el (dired-mode): Set buffer-local
'window-point-context-set-function' to remember 'dired-filename'
or 'position' in the window with the Dired buffer.
Set buffer-local 'window-point-context-use-function' to restore
the remembered position of the window point.

* lisp/tab-bar.el (tab-bar--tab): Use window-point-context-set.
(tab-bar-select-restore-context): New user option.
(tab-bar-select-tab): Use window-point-context-use.

* lisp/window.el: Add '(context . writable)' to
'window-persistent-parameters'.
(window-point-context-set, window-point-context-use): New functions.
(window-point-context-set-default-function)
(window-point-context-use-default-function): New functions.
(window-point-context-set-function)
(window-point-context-use-function): New variables.

2 years agoFix json-insert unibyte buffer bug (bug#70007)
Mattias Engdegård [Tue, 2 Apr 2024 16:58:09 +0000 (18:58 +0200)]
Fix json-insert unibyte buffer bug (bug#70007)

Previously, a unibyte target buffer could be put in an incorrect state
if json-insert was used to insert non-ASCII characters.

* src/json.c (Fjson_insert): Simplify.  Don't attempt to decode the data
being inserted: it is guaranteed to be correct UTF-8 and is correct for
both unibyte and multibyte buffers.
* test/src/json-tests.el (json-serialize/roundtrip)
(json-serialize/roundtrip-scalars): Extend tests.

2 years agojson-insert doc fixes
Mattias Engdegård [Tue, 2 Apr 2024 15:51:38 +0000 (17:51 +0200)]
json-insert doc fixes

* src/json.c (Fjson_insert): Precise the behaviour when the current
buffer is multibyte and unibyte, respectively.
* doc/lispref/text.texi (Parsing JSON): Refer to the right function.

2 years agoNew condition/action entry 'category' for 'display-buffer' (bug#69983)
Juri Linkov [Tue, 2 Apr 2024 16:51:51 +0000 (19:51 +0300)]
New condition/action entry 'category' for 'display-buffer' (bug#69983)

* doc/lispref/windows.texi (Choosing Window): Provide an example
of using '(category . comint)' in the condition of 'display-buffer-alist'
and in the action of 'display-buffer'.
(Buffer Display Action Alists): Add a new action alist entry 'category'.

* lisp/subr.el (buffer-match-p): Add a new condition 'category'.

* lisp/window.el (display-buffer): Document a new action alist entry
'category'.

2 years agoUpdate JSON codec doc strings
Mattias Engdegård [Mon, 1 Apr 2024 15:02:58 +0000 (17:02 +0200)]
Update JSON codec doc strings

* src/json.c (Fjson_serialize, Fjson_insert, Fjson_parse_string)
(Fjson_parse_buffer): Make the text more readable, fix minor
errors and avoid terminology confusion.

2 years ago; * src/json.c (json_parse_object): Call make_hash_table directly.
Mattias Engdegård [Mon, 1 Apr 2024 15:01:07 +0000 (17:01 +0200)]
; * src/json.c (json_parse_object): Call make_hash_table directly.

2 years agoUpdate JSON parser test and docs
Mattias Engdegård [Mon, 1 Apr 2024 14:58:03 +0000 (16:58 +0200)]
Update JSON parser test and docs

* test/src/json-tests.el (json-parse-string/object):
Duplicated object keys are now retained in alist and plist output.
* etc/NEWS: Mention it.

2 years ago(scheme-syntax-propertize-sexp-comment): Allow `#;` in strings
Po Lu [Mon, 1 Apr 2024 14:46:19 +0000 (10:46 -0400)]
(scheme-syntax-propertize-sexp-comment): Allow `#;` in strings

* lisp/progmodes/scheme.el (scheme-syntax-propertize-sexp-comment):
Don't get confused by `#;` inside strings and (normal) comments.
(scheme-sexp-comment-syntax-table): Comment-out, unused.

2 years agoCorrect custom type in tramp-androidsu.el
Po Lu [Mon, 1 Apr 2024 13:12:49 +0000 (21:12 +0800)]
Correct custom type in tramp-androidsu.el

* lisp/net/tramp-androidsu.el (tramp-androidsu-remote-path): Set
type to '(repeat string).

2 years ago; json.c stylistic adjustments
Po Lu [Mon, 1 Apr 2024 13:12:19 +0000 (21:12 +0800)]
; json.c stylistic adjustments

* src/json.c (json_parse_string): Stylistic changes.

2 years ago; * doc/lispref/processes.texi: use @code for keywords in @table
Mattias Engdegård [Mon, 1 Apr 2024 12:41:37 +0000 (14:41 +0200)]
; * doc/lispref/processes.texi: use @code for keywords in @table

See discussion in bug#69709.

2 years agoMerge branch 'master' of git.savannah.gnu.org:/srv/git/emacs
Eli Zaretskii [Mon, 1 Apr 2024 11:21:10 +0000 (14:21 +0300)]
Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs

2 years agoAdd support for `ch' and `cw' dimension specifiers for images
Zajcev Evgeny [Thu, 21 Mar 2024 14:47:29 +0000 (17:47 +0300)]
Add support for `ch' and `cw' dimension specifiers for images

* src/image.c (image_get_dimension, lookup_image): Handle `ch'
and `cw' dimension specifiers in addition to `em'.
* src/dispextern.h: Add new members `face_font_height' and
`face_font_width' to `struct image'.

* doc/lispref/display.texi (Image Descriptors): Document
`ch' and `cw'.

2 years ago* etc/NEWS: Mention a JSON codec improvement.
Mattias Engdegård [Mon, 1 Apr 2024 11:09:23 +0000 (13:09 +0200)]
* etc/NEWS: Mention a JSON codec improvement.

2 years agoFix symbol list matching regexps.
Vladimir Kazanov [Sun, 31 Mar 2024 17:32:59 +0000 (18:32 +0100)]
Fix symbol list matching regexps.

Fix symbol list matching regexp performance

Allow empty face lists, improve the face list matching regexp (see
discussion in Bug#69714) based on relint's comments, add tests:
* test/lisp/emacs-lisp/ert-font-lock-tests.el: Add tests.
* lisp/emacs-lisp/ert-font-lock.el: Fix regexps.

2 years agoDon't signal `json-end-of-file` for short nonempty bad JSON inputs
Mattias Engdegård [Sun, 31 Mar 2024 17:19:58 +0000 (19:19 +0200)]
Don't signal `json-end-of-file` for short nonempty bad JSON inputs

* src/json.c (json_parse_value): Generate a plain parse error.
* test/src/json-tests.el (json-parse-string/short): Adapt test.

2 years agoFaster JSON parsing
Mattias Engdegård [Sun, 31 Mar 2024 13:00:00 +0000 (15:00 +0200)]
Faster JSON parsing

Speed up JSON parsing substantially by only UTF-8-parsing string
literals and only exactly once.  Previously, json-parse-string always
first parsed the entire input and copied it to a new string, and then
validated each string literal twice.

We no longer create an extra new string when interning an alist key,
nor do we garble plist keys with Unicode characters.

* src/lread.c (intern_c_multibyte): New.
* src/json.c (json_encode): Remove.
(utf8_error): New.
(json_parse_string): Faster and more careful UTF-8 decoding.
Create and return a new multibyte string or symbol without extra
decoding.  All callers adapted.
(Fjson_parse_string): Skip expensive input pre-decoding.
* test/src/json-tests.el (json-parse-string/object-unicode-keys)
(json-parse-string/short): New.
(json-parse-string/string, json-parse-string/invalid-unicode):
Adapt tests.
* etc/NEWS: Mentioned change in errors.

2 years agoNative JSON support is always available
Mattias Engdegård [Sun, 31 Mar 2024 13:07:34 +0000 (15:07 +0200)]
Native JSON support is always available

* lisp/progmodes/sh-script.el (sh--json-read): Remove.
(sh-shellcheck-flymake): Call json-parse-buffer directly.
* test/src/json-tests.el: Don't check for function availability.

2 years agoFix mutates-arguments warning for `sort`
Mattias Engdegård [Sun, 31 Mar 2024 14:12:45 +0000 (16:12 +0200)]
Fix mutates-arguments warning for `sort`

* lisp/emacs-lisp/bytecomp.el (bytecomp--sort-call-in-place-p)
(bytecomp--mutargs-nconc, bytecomp--mutargs-sort): New.
(byte-compile-form, bytecomp--actually-important-return-value-p)
(mutating-fns):
Use a slightly more extendible scheme for specifying what arguments
a function mutates.  Give `sort` special treatment.

2 years ago(scheme-syntax-propertize-sexp-comment): Handle nested sexp-comments
Stefan Monnier [Mon, 1 Apr 2024 06:12:51 +0000 (02:12 -0400)]
(scheme-syntax-propertize-sexp-comment): Handle nested sexp-comments

Well, I'm not completely sure this will work right in all cases,
because I've been confused about this in the past.
It works in my test case, at least.

* lisp/progmodes/scheme.el (scheme-syntax-propertize-sexp-comment):
Look for nested `#;` and mark them appropriately.

2 years agoFix androidsu's `make-process' file name handler
Po Lu [Mon, 1 Apr 2024 06:04:56 +0000 (14:04 +0800)]
Fix androidsu's `make-process' file name handler

* lisp/net/tramp-androidsu.el
(tramp-androidsu-handle-make-process): Disable exec loader
around call to setuid su binary.

2 years ago(scheme-syntax-propertize-sexp-comment): Remove unused argument
niceume [Sun, 24 Mar 2024 03:29:56 +0000 (12:29 +0900)]
(scheme-syntax-propertize-sexp-comment): Remove unused argument

* lisp/progmodes/scheme.el (scheme-syntax-propertize-sexp-comment):
Remove first arg, unused.
(scheme-syntax-propertize): Adjust calls accordingly.

2 years agoscheme.el: Enable dealing with regular expression literal
niceume [Sun, 17 Mar 2024 00:12:32 +0000 (09:12 +0900)]
scheme.el: Enable dealing with regular expression literal

* lisp/progmodes/scheme.el (scheme-syntax-propertize-regexp): New function.
(scheme-syntax-propertize): Use it.

2 years agoFix listing of Android root directory when it is accessible
Po Lu [Mon, 1 Apr 2024 01:26:03 +0000 (09:26 +0800)]
Fix listing of Android root directory when it is accessible

* src/androidvfs.c (android_root_closedir, android_root_dirfd)
(android_root_opendir): Allocate an ersatz file descriptor even
if directory is non-NULL, so that at-funcs will properly return
file status for virtual files in the root directory.

2 years agoFix wildcard signals in dbusbind.c
Michael Albinus [Sun, 31 Mar 2024 17:59:58 +0000 (19:59 +0200)]
Fix wildcard signals in dbusbind.c

* src/dbusbind.c (xd_read_message_1): Handle registered signals
with wildcards.  (Bug#69926)

2 years agoAdapt Tramp version integrated in Emacs 29.3
Michael Albinus [Sun, 31 Mar 2024 12:21:58 +0000 (14:21 +0200)]
Adapt Tramp version integrated in Emacs 29.3

* lisp/net/trampver.el:
Adapt Tramp version integrated in Emacs 29.3.

2 years agoList special directories when reading root directory on Android
Po Lu [Sun, 31 Mar 2024 07:33:40 +0000 (15:33 +0800)]
List special directories when reading root directory on Android

* src/androidvfs.c (root_vfs_ops): Substitute
android_root_opendir for android_root_opendir.
(struct android_root_vdir): New structure.
(root_fd, root_fd_references): New variables.
(android_root_readdir, android_root_closedir, android_root_dirfd)
(android_root_opendir): New functions.
(android_fstatat_1): Test provided fd against root_fd, and if
they match, prefix FILENAME with the name of the root directory.

* lisp/ls-lisp.el (ls-lisp-insert-directory): If d-f-a-a signals
an error while retrieving attributes, compile the alist of
directory contents by hand.

2 years agoAdd global minor mode 'global-completion-preview-mode'
Eshel Yaron [Tue, 26 Mar 2024 21:34:51 +0000 (22:34 +0100)]
Add global minor mode 'global-completion-preview-mode'

This is a global variant of 'completion-preview-mode'.

* lisp/completion-preview.el (global-completion-preview-mode): New
global minor mode.

* doc/emacs/programs.texi (Symbol Completion): Document it.

* etc/NEWS: Announce it.  (Bug#70010)

2 years agoFix the new PEG library
Eli Zaretskii [Sun, 31 Mar 2024 07:29:34 +0000 (10:29 +0300)]
Fix the new PEG library

* doc/lispref/peg.texi (Parsing Expression Grammars)
(PEX Definitions, Parsing Actions, Writing PEG Rules): Fix markup,
indexing, and wording.

* etc/NEWS: Fix wording of PEG entry.

* test/lisp/progmodes/peg-tests.el: Move from test/lisp/, to match
the directory of peg.el.

2 years ago; Another round of stylistic fixes in json.c
Eli Zaretskii [Sun, 31 Mar 2024 06:31:58 +0000 (09:31 +0300)]
; Another round of stylistic fixes in json.c

* src/json.c (json_parser_init, json_parse_object)
(json_parse_value, Fjson_parse_string, json_parse)
(json_create_float, json_create_integer, json_parse_args): Fix
whitespace and indentation.

2 years ago; json.c stylistic adjustments
Po Lu [Sun, 31 Mar 2024 00:26:48 +0000 (08:26 +0800)]
; json.c stylistic adjustments

* src/json.c (json_signal_error, json_parser_init)
(json_parse_object, json_parse_value, syms_of_json): Tabify and
wrap unacceptably long lines.

2 years ago; json.c stylistic adjustments
Po Lu [Sun, 31 Mar 2024 00:22:56 +0000 (08:22 +0800)]
; json.c stylistic adjustments

* src/json.c (json_parse_args, json_out_t, symset_t, symset_size)
(Fjson_serialize, Fjson_insert): Tabify and modify all sentences
to be punctuated with two spaces.

2 years agoAdd peg.el as a built-in library
Eric Abrahamsen [Tue, 6 Dec 2022 05:59:03 +0000 (21:59 -0800)]
Add peg.el as a built-in library

* lisp/progmodes/peg.el: New file, taken from ELPA package.
* test/lisp/peg-tests.el: Package tests.
* doc/lispref/peg.texi: Documentation.

2 years agoMake gnus cache work with group names having '/'
James Thomas [Thu, 14 Mar 2024 03:12:00 +0000 (08:42 +0530)]
Make gnus cache work with group names having '/'

Make `gnus-cache-file-name` use the existing
`nnmail-group-pathname`.

* lisp/gnus/gnus-cache.el (gnus-cache-file-name)
(gnus-cache-update-article):
* lisp/gnus/nnmail.el (nnmail-group-pathname):

2 years agoDisable workDoneProgress if defcustom is nil
Theodor Thornhill [Sat, 30 Mar 2024 08:35:16 +0000 (09:35 +0100)]
Disable workDoneProgress if defcustom is nil

There is no need to receive the $/progress notifications from the server
if we don't want to render them. Because they are effectively ignored
when eglot-report-progress is nil we'd rather not waste cycles on serde
of the messages.

* lisp/progmodes/eglot.el (eglot-client-capabilities): use value from
defcustom to decide whether or not to advertise to server.

2 years agoFix typo in docstring
Theodor Thornhill [Fri, 29 Mar 2024 08:18:53 +0000 (09:18 +0100)]
Fix typo in docstring

* lisp/progmodes/eglot.el (eglot-lsp-server): eglot-current-server is
now exposed.

2 years agoFix the native JSON support code
Eli Zaretskii [Sat, 30 Mar 2024 16:33:23 +0000 (19:33 +0300)]
Fix the native JSON support code

* src/Makefile.in (base_obj): Add the missing json.o.  Without
this, we get link error.
* src/json.c (json_serialize): Don't use too sophisticated C99
features, as they confuse make-docfile.  Initialize all the
members explicitly.

2 years agoAlways enable native JSON support and remove Jansson references
Mattias Engdegård [Sat, 30 Mar 2024 14:13:24 +0000 (15:13 +0100)]
Always enable native JSON support and remove Jansson references

* src/json.c (Fjson__available_p): Remove.
* lisp/subr.el (json-available-p): Always return t.
* admin/nt/dist-build/build-dep-zips.py:
* configure.ac:
* doc/lispref/text.texi (Parsing JSON):
* java/INSTALL:
* java/org/gnu/emacs/EmacsNative.java (EmacsNative):
* lisp/term/w32-win.el (dynamic-library-alist):
* m4/ndk-build.m4 (ndk_INIT):
* msdos/sed1v2.inp:
* nt/INSTALL:
* nt/INSTALL.W64:
* src/Makefile.in:
* src/emacs.c (main):
* src/lisp.h:
Remove JSON configuration options and references to it and Jansson from
documentation and build files.
* etc/NEWS: Announce.

2 years agoNew JSON encoder (bug#70007)
Mattias Engdegård [Tue, 26 Mar 2024 15:44:09 +0000 (16:44 +0100)]
New JSON encoder (bug#70007)

It is in general at least 2x faster than the old encoder and does not
depend on any external library.  Using our own code also gives us
control over translation details: for example, we now have full
bignum support and tighter float formatting.

* src/json.c (json_delete, json_initialized, init_json_functions)
(json_malloc, json_free, init_json, json_out_of_memory)
(json_releae_object, check_string_without_embedded_nulls, json_check)
(json_check_utf8, lisp_to_json_nonscalar_1, lisp_to_json_nonscalar)
(lisp_to_json, json_available_p, ensure_json_available, json_insert)
(json_handle_nonlocal_exit, json_insert_callback):
Remove.  Remaining uses updated.
* src/json.c (json_out_t, symset_t, struct symset_tbl)
(symset_size, make_symset_table, push_symset, pop_symset)
(cleanup_symset_tables, symset_hash, symset_expand, symset_add)
(json_out_grow_buf, cleanup_json_out, json_make_room, JSON_OUT_STR)
(json_out_str, json_out_byte, json_out_fixnum, string_not_unicode)
(json_plain_char, json_out_string, json_out_nest, json_out_unnest)
(json_out_object_cons, json_out_object_hash), json_out_array)
(json_out_float, json_out_bignum, json_out_something)
(json_out_to_string, json_serialize): New.
(Fjson_serialize, Fjson_insert):
New JSON encoder implementation.
* test/src/json-tests.el (json-serialize/object-with-duplicate-keys)
(json-serialize/string): Update tests.

2 years agoMerge branch 'master' of git.savannah.gnu.org:/srv/git/emacs
Eli Zaretskii [Sat, 30 Mar 2024 13:37:27 +0000 (16:37 +0300)]
Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs

2 years agobug#69992: Minor improvement to image map transformation logic
David Ponce [Sat, 30 Mar 2024 12:59:41 +0000 (13:59 +0100)]
bug#69992: Minor improvement to image map transformation logic

* lisp/image.el (image--compute-rotation): New function.
(image--compute-map, image--compute-original-map): Use it.
Ensure all transformations are applied or undone according to what
Emacs does internally.  Call a transformation function only when
needed.  Fix doc string.
(image--scale-map, image--rotate-map): Assume effective scale
argument.
(image--rotate-coord): Improve doc string.
(image--flip-map): Remove no more used argument FLIP.

* test/lisp/image-tests.el (image-create-image-with-map): Use a
valid SVG image otherwise `image-size' will not return a valid
value and calculation of scale could fail.
(image-transform-map): Update according to changed signature of
`image--flip-map'.

2 years agoAdd use-package-vc-prefer-newest user option
Tony Zorman [Thu, 21 Dec 2023 16:51:09 +0000 (17:51 +0100)]
Add use-package-vc-prefer-newest user option

* lisp/use-package/use-package-core.el (use-package-vc-prefer-newest):
User option to prefer the latest commit (as opposed to the latest
release) of a package.
(use-package-normalize--vc-arg): Check for
use-package-vc-prefer-newest.

* doc/misc/use-package.texi (Install package): Document
use-package-vc-prefer-newest.

* etc/NEWS: Document use-package-vc-prefer-newest.

2 years agoMerge from origin/emacs-29
Eli Zaretskii [Sat, 30 Mar 2024 08:38:18 +0000 (04:38 -0400)]
Merge from origin/emacs-29

946d4aad1df Avoid errors in Info-search-case-sensitively in DIR buffers
fbf68302999 Add test for previous change (bug#70023)
bcf6dd6e266 Add typescript-ts-mode indentation for interface bodies (...

2 years ago; Merge from origin/emacs-29
Eli Zaretskii [Sat, 30 Mar 2024 08:38:18 +0000 (04:38 -0400)]
; Merge from origin/emacs-29

The following commit was skipped:

95d9e6eb6b4 * Don't install unnecessary trampolines (bug#69573) (don'...

2 years agoMerge from origin/emacs-29
Eli Zaretskii [Sat, 30 Mar 2024 08:38:17 +0000 (04:38 -0400)]
Merge from origin/emacs-29

38faacf353f Improve documentation of <Delete> in user manual
9d3d77f12da Fix documentation of 'other-window-for-scrolling'

2 years ago; Merge from origin/emacs-29
Eli Zaretskii [Sat, 30 Mar 2024 08:38:17 +0000 (04:38 -0400)]
; Merge from origin/emacs-29

The following commit was skipped:

96fb7199424 Bump Emacs version to 29.3.50

2 years agoMerge from origin/emacs-29
Eli Zaretskii [Sat, 30 Mar 2024 08:37:43 +0000 (04:37 -0400)]
Merge from origin/emacs-29

ae8f815613c Update files for Emacs 29.3

2 years ago; Merge from origin/emacs-29
Eli Zaretskii [Sat, 30 Mar 2024 08:36:13 +0000 (04:36 -0400)]
; Merge from origin/emacs-29

The following commits were skipped:

ff6cc3d2cf0 * lisp/ldefs-boot.el: Regenerate.
0dab0c0d688 Bump Emacs version to 29.3

2 years agoMerge from origin/emacs-29
Eli Zaretskii [Sat, 30 Mar 2024 08:35:24 +0000 (04:35 -0400)]
Merge from origin/emacs-29

7a5d7be52c5 org--confirm-resource-safe: Fix prompt when prompting in ...
2bc865ace05 org-file-contents: Consider all remote files unsafe
6f9ea396f49 org-latex-preview: Add protection when `untrusted-content...
937b9042ad7 * lisp/gnus/mm-view.el (mm-display-inline-fontify): Mark ...
ccc188fcf98 * lisp/files.el (untrusted-content): New variable.
befa9fcaae2 org-macro--set-templates: Prevent code evaluation
3221d8d4611 * admin/authors.el (authors-aliases): Add ignored authors.
8d8253f8991 * etc/NEWS: Update for Emacs 29.3

2 years ago; Fix last change in inclusion of byteswap.h header
Eli Zaretskii [Sat, 30 Mar 2024 07:52:00 +0000 (10:52 +0300)]
; Fix last change in inclusion of byteswap.h header

* src/w32uniscribe.c (w32hb_get_font_table): Avoid warning due to
redefinition of 'bswap_32'.

2 years agoMerge branch 'master' of git.savannah.gnu.org:/srv/git/emacs
Eli Zaretskii [Sat, 30 Mar 2024 07:38:34 +0000 (10:38 +0300)]
Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs

2 years agoFix implicit declaration of bswap_{32,64}
Andreas Schwab [Sat, 30 Mar 2024 07:29:52 +0000 (08:29 +0100)]
Fix implicit declaration of bswap_{32,64}

* src/data.c: Move include of <byteswap.h> ...
* src/lisp.h: ... here.

2 years agoClean up removal of libjansson parser
Eli Zaretskii [Sat, 30 Mar 2024 07:37:09 +0000 (10:37 +0300)]
Clean up removal of libjansson parser

* src/json.c (json_has_suffix, json_has_prefix): Remove unused
functions.
(json_object_key_to_iter, json_array_get, json_loads)
(json_load_callback, json_object_iter, json_object_iter_value)
(json_string_value, json_object_size, json_object_iter_key)
(json_object_iter_next, json_real_value, json_string_length)
(json_integer_value) [WINDOWSNT]: Don't DEF_DLL_FN, don't
LOAD_DLL_FN, and don't define a macro for unused libjansson
functions.
(JSON_HAS_ERROR_CODE): Remove: not used.

2 years agoReplace libjansson JSON parser with a custom one
Géza Herman [Wed, 6 Mar 2024 12:14:50 +0000 (13:14 +0100)]
Replace libjansson JSON parser with a custom one

* src/json.c (json_parse_error, json_to_lisp)
(json_read_buffer_callback): Remove functions.
(struct json_parser): New struct.
(json_signal_error, json_parser_init, json_parser_done)
(json_make_object_workspace_for_slow_path)
(json_make_object_workspace_for, json_byte_workspace_reset)
(json_byte_workspace_put_slow_path, json_byte_workspace_put)
(json_input_at_eof, json_input_switch_to_secondary)
(json_input_get_slow_path, json_input_get)
(json_input_get_if_possible, json_input_put_back)
(json_skip_whitespace_internal, json_skip_whitespace)
(json_skip_whitespace_if_possible, json_hex_value)
(json_parse_unicode, json_handle_utf8_tail_bytes)
(json_parse_string, json_create_integer, json_create_float)
(json_parse_number, json_parse_array)
(json_parse_object_member_value, json_parse_object)
(json_is_token_char, json_parse_value, json_parse): New functions.
(Fjson_parse_buffer, Fjson_parse_string): Adjust to changes in the
parser.
(syms_of_json): DEFSYM new symbols and define_error new errors.

2 years agoDisable VC in special directories on Android
Po Lu [Sat, 30 Mar 2024 07:05:30 +0000 (15:05 +0800)]
Disable VC in special directories on Android

* lisp/vc/vc-hooks.el (vc-registered, vc-backend): Return nil
without invoking any backend if FILE or FILE-OR-LIST sits within
/content or /assets.

2 years agoAvoid errors in Info-search-case-sensitively in DIR buffers
Eli Zaretskii [Sat, 30 Mar 2024 07:00:02 +0000 (10:00 +0300)]
Avoid errors in Info-search-case-sensitively in DIR buffers

* lisp/info.el (Info-search): Don't run the "try other subfiles"
code if there are no subfiles.  This happens, for example, in DIR
files.  (Bug#70058)

2 years agoRationalize java/Makefile.in
Po Lu [Sat, 30 Mar 2024 01:59:36 +0000 (09:59 +0800)]
Rationalize java/Makefile.in

* java/Makefile.in: (emacs.apk-in): Bring commentary up to date,
and package classes.dex at this stage of the process.
($(APK_NAME)): Adjust to match.

2 years agoFix building the SFNT font driver
Po Lu [Sat, 30 Mar 2024 00:58:59 +0000 (08:58 +0800)]
Fix building the SFNT font driver

* src/sfntfont.c (sfntfont_list, sfntfont_list_family): Update
calls to Fsort for the new calling convention.

2 years ago* lisp/emacs-lisp/comp.el (comp--add-cond-cstrs): Consolidate 2 cases
Stefan Monnier [Fri, 29 Mar 2024 19:36:45 +0000 (15:36 -0400)]
* lisp/emacs-lisp/comp.el (comp--add-cond-cstrs): Consolidate 2 cases

2 years ago* lisp/cedet/semantic/tag.el (semantic-tag): New type
Stefan Monnier [Fri, 29 Mar 2024 19:32:48 +0000 (15:32 -0400)]
* lisp/cedet/semantic/tag.el (semantic-tag): New type

2 years ago; * lisp/shell.el (w32-application-type): Fix 'declare-function'.
Eli Zaretskii [Fri, 29 Mar 2024 15:26:38 +0000 (18:26 +0300)]
; * lisp/shell.el (w32-application-type): Fix 'declare-function'.

2 years ago`value<` manual entry adjustments (bug#69709)
Mattias Engdegård [Fri, 29 Mar 2024 14:25:22 +0000 (15:25 +0100)]
`value<` manual entry adjustments (bug#69709)

* doc/lispref/sequences.texi (Sequence Functions):
Explain lexicographical ordering.  Note the dual nature of `nil`.
Mention the depth limit.

2 years ago* src/fns.c (Fvaluelt): More generous depth limit (20 -> 200).
Mattias Engdegård [Fri, 29 Mar 2024 14:23:56 +0000 (15:23 +0100)]
* src/fns.c (Fvaluelt): More generous depth limit (20 -> 200).

This gives `value<` the same limit as `equal` which seems about right.

2 years agoSupport `shell-resync-dirs' on msys bash (Bug#70012)
Sam Steingold [Fri, 29 Mar 2024 14:36:43 +0000 (10:36 -0400)]
Support `shell-resync-dirs' on msys bash (Bug#70012)

* lisp/shell.el (w32-application-type): Declare.
(shell-mode): Set `shell-dirstack-query' to `pwd -W` when using msys bash.

2 years ago; * doc/lispref/sequences.texi (Sequence Functions): Fix markup and examples.
Eli Zaretskii [Fri, 29 Mar 2024 12:03:44 +0000 (15:03 +0300)]
; * doc/lispref/sequences.texi (Sequence Functions): Fix markup and examples.

2 years ago; * test/lisp/vc/vc-git-tests.el: bend doc string quote
Mattias Engdegård [Fri, 29 Mar 2024 10:53:56 +0000 (11:53 +0100)]
; * test/lisp/vc/vc-git-tests.el: bend doc string quote

2 years agoBetter `sort` ignored-return-value warning
Mattias Engdegård [Sun, 24 Mar 2024 17:18:41 +0000 (18:18 +0100)]
Better `sort` ignored-return-value warning

* lisp/emacs-lisp/bytecomp.el (byte-compile-form)
(bytecomp--actually-important-return-value-p):
Special handling of `sort` that takes into account that it may return
an important value depending on the :in-place keyword argument.

2 years agoRemove `sort-on` (bug#69709)
Mattias Engdegård [Fri, 22 Mar 2024 14:06:27 +0000 (15:06 +0100)]
Remove `sort-on` (bug#69709)

* lisp/sort.el (sort-on):
* doc/lispref/sequences.texi (Sequence Functions):
* etc/NEWS:
Remove the `sort-on` function which is now completely superseded by
the extended `sort` in features, ease of use, and performance.

2 years agoUse new-style `sort` signature in Lisp manual examples
Mattias Engdegård [Fri, 22 Mar 2024 14:08:50 +0000 (15:08 +0100)]
Use new-style `sort` signature in Lisp manual examples

* doc/lispref/help.texi (Accessing Documentation):
* doc/lispref/strings.texi (Text Comparison):
Use the new sort calling convention (bug#69709).

2 years agoFaster non-destructive list sorting
Mattias Engdegård [Fri, 22 Mar 2024 10:54:09 +0000 (11:54 +0100)]
Faster non-destructive list sorting

Postpone the creation of a new list to after sorting which turns out to
be a lot faster (1.1x - 1.5x speedup).

* src/fns.c (sort_list, sort_vector, Fsort):
Create the new list when moving the data out from the temporary array.

2 years agoSpeed up `sort` by special-casing the `value<` ordering
Mattias Engdegård [Thu, 21 Mar 2024 18:35:15 +0000 (19:35 +0100)]
Speed up `sort` by special-casing the `value<` ordering

This gives a 1.5x-2x speed-up when using the default :lessp value,
by eliminating the Ffuncall overhead.

* src/sort.c (order_pred_lisp, order_pred_valuelt): New.
(merge_state, inorder, binarysort, count_run, gallop_left, gallop_right)
(merge_init, merge_lo, merge_hi, tim_sort):
* src/fns.c (Fsort):
When using value<, call it directly.

2 years agoNew `sort` keyword arguments (bug#69709)
Mattias Engdegård [Tue, 19 Mar 2024 12:03:47 +0000 (13:03 +0100)]
New `sort` keyword arguments (bug#69709)

Add the :key, :lessp, :reverse and :in-place keyword arguments.
The old calling style remains available and is unchanged.

* src/fns.c (sort_list, sort_vector, Fsort):
* src/sort.c (tim_sort):
Add keyword arguments with associated new features.
All callers of Fsort adapted.
* test/src/fns-tests.el (fns-tests--shuffle-vector, fns-tests-sort-kw):
New test.
* doc/lispref/sequences.texi (Sequence Functions): Update manual.
* etc/NEWS: Announce.

2 years agoAdd back timsort key function handling (bug#69709)
Mattias Engdegård [Mon, 18 Mar 2024 18:56:20 +0000 (19:56 +0100)]
Add back timsort key function handling (bug#69709)

The original timsort code did provide for a key (accessor) function
along with the necessary storage management, but we dropped it because
our `sort` function didn't need it.

Now it's been put back since it seems that it will come in handy after all.

* src/fns.c (sort_list, sort_vector, Fsort): Pass Qnil as key function
to tim_sort.
* src/sort.c (reverse_slice, sortslice_copy)
(sortslice_copy_incr, sortslice_copy_decr, sortslice_memcpy)
(sortslice_memmove, sortslice_advance): New functions.
(sortslice): New type.
(struct stretch, struct reloc, merge_state)
(binarysort, merge_init, merge_markmem, cleanup_mem)
(merge_register_cleanup, merge_getmem, merge_lo, merge_hi, merge_at)
(found_new_run, reverse_sortslice, resolve_fun, tim_sort):
Merge back previously discarded parts from the upstreams timsort code
that dealt with key functions, and adapt them to fit in.

2 years agoAdd `value<` (bug#69709)
Mattias Engdegård [Sun, 10 Mar 2024 12:18:22 +0000 (13:18 +0100)]
Add `value<` (bug#69709)

It's a general-purpose polymorphic ordering function, like `<` but
for any two values of the same type.

* src/data.c (syms_of_data): Add the `type-mismatch` error.
(bits_word_to_host_endian): Move...
* src/lisp.h (bits_word_to_host_endian): ...here, and declare inline.
* src/fns.c (Fstring_lessp): Extract the bulk of this function to...
(string_cmp): ...this 3-way comparison function, for use elsewhere.
(bool_vector_cmp, value_cmp, Fvaluelt): New.
* lisp/emacs-lisp/byte-opt.el (side-effect-free-fns, pure-fns):
Add `value<`, which is pure and side-effect-free.
* test/src/fns-tests.el (fns-value<-ordered, fns-value<-unordered)
(fns-value<-type-mismatch, fns-value<-symbol-with-pos)
(fns-value<-circle, ert-deftest fns-value<-bool-vector): New tests.
* doc/lispref/sequences.texi (Sequence Functions):
* doc/lispref/numbers.texi (Comparison of Numbers):
* doc/lispref/strings.texi (Text Comparison):
Document the new value< function.
* etc/NEWS: Announce.

2 years ago; * java/org/gnu/emacs/EmacsActivity.java (isReallyFinishing): Fix typo.
Po Lu [Thu, 28 Mar 2024 11:57:22 +0000 (19:57 +0800)]
; * java/org/gnu/emacs/EmacsActivity.java (isReallyFinishing): Fix typo.

2 years agoPrevent Android OS task trimming from deleting Emacs frames
Po Lu [Thu, 28 Mar 2024 11:56:31 +0000 (19:56 +0800)]
Prevent Android OS task trimming from deleting Emacs frames

* doc/emacs/android.texi (Android Windowing): Document proviso
on Android 7.0 and later.

* java/org/gnu/emacs/EmacsActivity.java (EmacsActivity)
<timeOfLastInteraction>: New field.
(onStop, onResume): Set and clear timeOfLastInteraction.
(isReallyFinishing): New function.
(onDestroy): Don't delete frame even in the event isFinishing
returns true if more than 4 hours have elapsed since the
activity last moved into the background.

2 years agopp.el: Try and fix bug#70039
Stefan Monnier [Thu, 28 Mar 2024 19:31:04 +0000 (15:31 -0400)]
pp.el: Try and fix bug#70039

* lisp/emacs-lisp/pp.el (pp-fill): Avoid splitting `#N#` or `#[`.
* test/lisp/emacs-lisp/pp-tests.el (pp-tests--sanity): New test.

2 years agoAdd test for previous change (bug#70023)
Theodor Thornhill [Thu, 28 Mar 2024 18:02:09 +0000 (19:02 +0100)]
Add test for previous change (bug#70023)

* test/lisp/progmodes/typescript-ts-mode-resources/indent.erts: Add
test.

2 years agoAdd typescript-ts-mode indentation for interface bodies (bug#70023)
Noah Peart [Wed, 27 Mar 2024 05:44:48 +0000 (22:44 -0700)]
Add typescript-ts-mode indentation for interface bodies (bug#70023)

* lisp/progmodes/typescript-ts-mode.el
(typescript-ts-mode--indent-rules): Add indentation rule for
interface bodies.

2 years ago* lisp/emacs-lisp/cl-macs.el (list): Predefine predicate by hand
Stefan Monnier [Thu, 28 Mar 2024 16:27:54 +0000 (12:27 -0400)]
* lisp/emacs-lisp/cl-macs.el (list): Predefine predicate by hand

2 years agoFix a typo in flymake.el
Eli Zaretskii [Thu, 28 Mar 2024 10:15:13 +0000 (12:15 +0200)]
Fix a typo in flymake.el

* lisp/progmodes/flymake.el (flymake--update-eol-overlays): Use
'save-restriction', not 'save-excursion'.  (Bug#69984)

2 years agocopy-tree just image map, not entire image
Joseph Turner [Sat, 23 Mar 2024 20:29:17 +0000 (13:29 -0700)]
copy-tree just image map, not entire image

* lisp/image.el (image--compute-original-map): Copy only
the image map.  (Bug#69602)

2 years ago; * etc/NEWS: Announce new feature of Proced. (Bug#69784)
Eli Zaretskii [Thu, 28 Mar 2024 09:50:22 +0000 (11:50 +0200)]
; * etc/NEWS: Announce new feature of Proced.  (Bug#69784)

2 years agoAllow for auto updating only visible proced buffers (bug#69784)
Rahguzar [Fri, 15 Mar 2024 17:46:46 +0000 (18:46 +0100)]
Allow for auto updating only visible proced buffers (bug#69784)

* lisp/proced.el (proced-auto-update-flag): Document 'visible'
value and add it to the custom type.
(proced-auto-update-timer, proced-toggle-auto-update): Take
'visible' value into account.

2 years agoImprove ert-font-lock assertion parser (Bug#69714)
Vladimir Kazanov [Tue, 12 Mar 2024 11:14:54 +0000 (11:14 +0000)]
Improve ert-font-lock assertion parser (Bug#69714)

Fail on files with no assertions, parser now accepts multiple
carets per line and face lists:
* lisp/emacs-lisp/ert-font-lock.el: Assertion parser fix.
* test/lisp/emacs-lisp/ert-font-lock-resources/no-asserts.js:
* test/lisp/emacs-lisp/ert-font-lock-tests.el
(test-parse-comments--no-assertion-error)
(test-syntax-highlight-inline--caret-negated-wrong-face)
(test-macro-test--file-no-asserts): New test cases.
* doc/misc/ert.texi (Syntax Highlighting Tests): More syntax examples.